<?php


namespace app\admin\controller;


use app\admin\base\JwBase;
use app\model\Menu;
use app\model\Role;
use think\Exception;

class Index extends JwBase
{
    /**
     * info: 获取菜单
     * User: 伍先生
     * Argument:
     * DateTime: 2020/12/8 15:08
     * Url: getMenu
     */
    public function menus(){
        try{
            $listStr = Role::field("role")->findOrEmpty($this->role_id);
            if($listStr->isEmpty()) return $this->respInfo(3001);
            $data = Menu::getUserMenus($listStr->role);
            $this->respInfo(1000,$data);
        } catch (Exception $e) {
            $this->respInfo(2002);
        }
    }
}